<?php
if (file_exists(APPPATH.'models/basemodel.php')) include_once(APPPATH.'models/basemodel.php');

class CostModel extends BaseModel {
	
	public function CostModel() {
		parent::BaseModel();
		$this->setModel('cost');
		$this->obj =& get_instance();
		$this->load->database();
	}
	
	public function getCostsFor($jobid) {
		$sql = "SELECT C.*, CO.company_name
				FROM cost C LEFT JOIN company CO ON (C.supplierid = CO.id)
				WHERE C.jobid = ".intval($jobid)."
					AND C.deleted = 0
				ORDER BY C.cost_title";
		
		$rs = $this->db->query($sql)->result();
		
		if (count($rs)) return $rs;
		else return false;
	}
	
}

?>